package com.meetingshow.front.actions;

import java.util.List;

import org.apache.struts2.convention.annotation.Action;
import org.apache.struts2.convention.annotation.Namespace;
import org.apache.struts2.convention.annotation.ParentPackage;
import org.apache.struts2.convention.annotation.Result;

import com.meetingshow.cache.Cache;
import com.meetingshow.common.base.actions.BaseAction;
import com.meetingshow.meeting.uiservice.model.CityVO;
import com.meetingshow.meeting.uiservice.model.IndustryVO;

/**
 * Get the data of cities, industries.
 * @author ivan
 *
 */
@ParentPackage("json-default")
@Namespace("/data")
public class BasicDataAction extends BaseAction {
	/**
	 * 
	 */
	private static final long serialVersionUID = 7022485435589514285L;
	//private static final Logger logger = Logger.getLogger(BasicDataAction.class);
	
	private List<CityVO> cities;
	private List<IndustryVO> industries;
	
    /**
     * Get the data of all cities.
     * @return
     */
    @Action(value="cities",
    		results={
    			@Result(type="json", params={"root", "cities"})
    		}
    )
    public String getAllCities() {
    	cities = Cache.getInstance().getAllCities();
    	return SUCCESS;
    }

    /**
     * Get the data of all industries.
     * @return
     */
    @Action(value="industries",
    		results={
    			@Result(type="json", params={"root", "industries"})
    		}
    )
    public String getAllIndustries() {
    	industries = Cache.getInstance().getAllIndustries();
    	return SUCCESS;
    }

	public List<CityVO> getCities() {
		return cities;
	}

	public void setCities(List<CityVO> cities) {
		this.cities = cities;
	}

	public List<IndustryVO> getIndustries() {
		return industries;
	}

	public void setIndustries(List<IndustryVO> industries) {
		this.industries = industries;
	}
}
